package bbdd;
import java.sql.*;
import java.util.Date;

public class BDAveria {
	private static Statement st;
	private static Connection c;
	private static ResultSet reg;
 
	
public static void insertarAveria(int codAv, Date fec ,String des, boolean arr,double gastos ,int pc, BaseDatos bbdd){	
String cadena="INSERT into averia VALUES(" + codAv +",'"+ fec +"','"+ des + "',"+ arr + ","+ gastos + "," + pc + ")";
	
	bbdd.abrir();
	try{
		c=bbdd.getConexion();
		st=c.createStatement();
		st.executeUpdate(cadena);
		st.close();	
		bbdd.cerrar();
	}
	catch(SQLException e){
		System.out.println(e.getMessage());
	}
	bbdd.cerrar();
	
	
}

public static void arregloAveria(boolean arr,int pc, BaseDatos bbdd){	
	String cadena="UPDATE averia set arreglado=' "+ arr +"'where ordenador='"+pc;
		
		
		try{
			c=bbdd.getConexion();
			st=c.createStatement();
			st.executeUpdate(cadena);
			st.close();				
		}
		catch(SQLException e){
			System.out.println(e.getMessage());
		}
		
		
	}




}

